/*
 * COPYRIGHT. ShenZhen iByte Technology Co., Ltd. 2018.
 * ALL RIGHTS RESERVED.
 *
 * No part of this publication may be reproduced, stored in a retrieval system, or transmitted,
 * on any form or by any means, electronic, mechanical, photocopying, recording, 
 * or otherwise, without the prior written permission of ShenZhen iByte Network Technology Co., Ltd.
 *
 * Amendment History:
 * 
 * Date                   By              Description
 * -------------------    -----------     -------------------------------------------
 * Nov 30, 2018    Li.shangzhi         Create the class
*/
package com.github.icloud.elasticsearch.api.docment;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import org.elasticsearch.action.update.UpdateRequest;
import org.junit.Test;
import com.github.icloud.elasticsearch.ElasticsearchClientBase;
/**
 * @FileName UpdateAPI.java
 * @Description: 更新文档
 *
 * @Date Nov 30, 2018 6:56:07 PM
 * @author Li.shangzhi
 * @version 1.0
 */
public class UpdateAPI extends ElasticsearchClientBase{
	
	@Test
	public void iEsUpdate() throws Exception{
		UpdateRequest updateRequest = new UpdateRequest();
		updateRequest.index("icloud-alarm");
		updateRequest.type("icloud-monitor-alarm");
		updateRequest.id("4f0b2a9cc4584b92a1f335ed071afe42");
		updateRequest.doc(jsonBuilder()
				.startObject()
				.field("name-CI/CD","elasticsearch")
				.endObject());
		client.update(updateRequest).get();
	}

}
